package github.flandre.examplemod.common.block;

import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.util.Direction;
import net.minecraft.util.math.shapes.IBooleanFunction;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;

import java.util.stream.Stream;
//Blockbench生成了三个文件 贴图.png .java 和 .json
//json放到models/block中 png放到textures/block中
//json需要修改一下贴图位置
/*
* "textures": {
		"0": "examplemod:block/custom_block",
		"particle": "examplemod:block/custom_block"
	},
* */

//另外blockstates是复制其他方块的
//最后加上物品的贴图



public class CustomBlock extends BaseBlock{
    //模型的导入
    //Stream.of开始都是从Blockbench生成的
    private static final VoxelShape SHAPES = Stream.of(
            Block.makeCuboidShape(0, 0, 0, 16, 4, 16),
            Block.makeCuboidShape(0, 3, 0, 16, 7, 13),
            Block.makeCuboidShape(0, 6, 0, 16, 10, 10),
            Block.makeCuboidShape(0, 9, 0, 16, 13, 7),
            Block.makeCuboidShape(0, 12, 0, 16, 16, 4)
    ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR)).get();

    public CustomBlock() {
        super(AbstractBlock.Properties.create(Material.ROCK).hardnessAndResistance(1.5F,100.0F));
        runCalution(SHAPES);
    }

    public void runCalution(VoxelShape voxelShape)
    {
        for(Direction direction :Direction.values())
        {
            calulateShape(direction,voxelShape);
        }
    }
}
